//
//  工程名称:XJL_WeChat
//  文件名称:XJLSettingViewController.m
//
//  创建者  :Created by 许佳莉
//  创建时间:on 16/8/1.
//  版权   :  Copyright © 2016年 Xujiali. All rights reserved.
//

#import "XJLSettingViewController.h"
#import "XJLLoginViewController.h"

@interface XJLSettingViewController()
@property (weak, nonatomic) IBOutlet UILabel *weChatIDLabel;

@end

@implementation XJLSettingViewController

-(void)viewDidLoad{
    [super viewDidLoad];
    
    //显示当前用户名
    NSDictionary *loginInfo = [[EaseMob sharedInstance].chatManager loginInfo];
    self.weChatIDLabel.text = [NSString stringWithFormat:@"WeChatID: %@",loginInfo[@"username"]];
//    XJLLog(@"%@",loginInfo);
}

- (IBAction)logOffAction {
    
    [SVProgressHUD showWithStatus:@"退出中..."];
    [[EaseMob sharedInstance].chatManager asyncLogoffWithUnbindDeviceToken:YES completion:^(NSDictionary *info, EMError *error) {
        if (!error) {//退出成功,回到登录界面
            [SVProgressHUD dismiss];
            self.view.window.rootViewController = [[XJLLoginViewController alloc]init];
            
        }else{//退出失败
            [SVProgressHUD showErrorWithStatus:error.description];
        }
    } onQueue:nil];
    
}

@end
